/* __placeholder__ */
export default (await import('vue')).defineComponent({
data() {
return {
form: {
region1: "",
region2: "",
idCard: "",
name: "",
phone: "",
email: "",
gender: "",
group: "",
date: "",
password1: "",
password2: "",
agree: "",
},
rules: {
region1: [{ required: true, message: "请选择城市", trigger: 'blur' }],
region2: [{ required: true, message: "请选择城市", trigger: 'change' }],
idCard: [
{ required: true, message: '请输入身份证号码', trigger: 'blur' },
{ min: 18, max: 18, message: '请输入18位的身份证号码', trigger: 'blur' }
],
gender: [
{ required: true, message: '请选择', trigger: 'blur' },
{ max: 20, message: '请不要大于20字', trigger: 'blur' }
],

group: [
{ required: true, message: '请选择', trigger: 'blur' }
],

face: [
{ required: true, message: '请选择', trigger: 'blur' }
],

date: [
{ required: true, message: '请选择日期', trigger: 'blur' }
],
name: [
{ required: true, message: '请填写联系人姓名,20字以内', trigger: 'blur' }
],
phone: [
{ required: true, message: '请输入11位手机号', trigger: 'blur' },
{ min: 11, max: 11, message: '请输入11位手机号码', trigger: 'blur' }
],
email: [
{ required: true, message: '请填写邮箱', trigger: 'blur' },
{ type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change'] },
],

password1: [
{ required: true, message: '密码长度至少大于等于6位', trigger: 'blur' },
{
validator: (rule, value, callback) => {
if (value === '') {
callback(new Error('请输入密码'));
} else {
if (this.form.password2 !== '') {
this.$refs.form.validateField('password2');
}
callback();
}
},
trigger: 'blur'
}
],
password2: [
{ required: true, message: '再次输入密码', trigger: 'blur' },
{
validator: (rule, value, callback) => {
if (value === '') {
callback(new Error('请再次输入密码'));
} else if (value !== this.form.password1) {
callback(new Error('两次输入密码不一致!'));
} else {
callback();
}
}, trigger: 'blur'
}
],
agree: [
{ required: true, message: '请先同意', trigger: 'blur' }
],
},
};
},
methods: {
onSubmit() {
this.$refs.form.validate((valid) => {
if (valid) {
console.log(this.form);
} else {
console.log('error submit!!');
return false;
}
});
},
},
});
